package edu.sctu.practice.class02.yangyuran.assign03.assign3_03;

/**
 * Created by Administrator on 2015/10/29.
 */
public class Client {
    public static void main(String[] args) {
        CloneableCircle c1 = new CloneableCircle(5);
        CloneableCircle c2 = (CloneableCircle) c1.clone();
        System.out.println("After copying c1 to c2");

        if (c1 == c2) System.out.println("c1 and c2 reference to the same object");
          else System.out.println("c1 and c2 don't point to the same object");
        if (c1.equals(c2)) System.out.println("c1 and c2 have the same contents");
          else System.out.println("c1 and c2 don't have the same contents");

        c1.setRadius(10);
        c1.getCreator().setFirstname("Michael");
        c1.getCreator().setMi("Z");
        System.out.println("\nAfter modifying c1");
        System.out.println("c1 " + c1);
        System.out.println("c2 " + c2);
        System.out.println();

        if (c1 instanceof Cloneable) {
            System.out.println("A CloneableCircle objec is cloneable");
        } else {
            System.out.println("A CloneableCircle objec is not cloneable");
        }

        Circle c = new Circle();
        if (c instanceof Cloneable) {
            System.out.println("A Circle object is cloneable");
        } else {
            System.out.println("A Circle object is not cloneable");
        }
    }
}

